export {};

class Person{
  name: string
  // 只允许在类中访问
  private age: number
  // 只允许在子类访问
  protected readonly gender:boolean

  constructor(name:string,age:number){
    this.name = name
    this.age = age
    this.gender = true
  }
}

class Student extends Person{
  private constructor(name:string,age:number){
    super(name,age)
    this.name = name
  }
  static create(name:string,age:number){
    return new Student(name,age)
  }
}

const tom = new Person('Lisa',18)
console.log(tom.name)
// console.log(tom.age)
// console.log(tom.gender)

const jack = Student.create('jack',18)